/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rule;

/**
 *
 * @author Daniel Gribel
 */
public class LettersAndNumbers extends Rule {

    public LettersAndNumbers() {
        super("2 combo points for letters and numbers");
    }

    @Override
    public void checkConditions(String dataEntry) {
        boolean lower = false;
        boolean upper = false;
        boolean number = false;
        
        for (int i = 0; i < dataEntry.length(); i++)
        {
            if (Character.isLowerCase(dataEntry.charAt(i)))
                lower = true;
            
            if (Character.isUpperCase(dataEntry.charAt(i)))
                upper = true;
            
            if (Character.isDigit(dataEntry.charAt(i))){
                number = true;
            }
        }
        
        if ((lower || upper) && number)
            setScore(2);
    }

    @Override
    public String outputMessage() {
        return getLog();
    }
    
}
